<template>
    <PageMain>
        <proTable ref="tableRef" :columns="columns" class="no-card" :init-param="initParam" :request-api="getTableList"
            :data-callback="dataCallback">
            <!-- 表格操作 -->
            <template #operation="scope">
                <el-button type="primary" link @click="enableFn(scope.row)">详情</el-button>
            </template>
        </proTable>
    </PageMain>
</template>

<script setup>
import api from "@/api";
const tableRef = ref();

const tableData = [{
    roleName: 'aaa'
}]
// 表格初始参数
const initParam = reactive({
    pageIndex: 1,
    pageSize: 10,
});
// dataCallback 是对于返回的表格数据做处理，如果你后台返回的数据不是 list && total 这些字段，可以在这里进行处理成这些字段
const dataCallback = (data) => {
    console.log(data)
    return {
        list: data.list,
        total: data.total
    };
};
const getTableList = (params) => {
    if (params.timekey) {
        params.startCreateTime = params.timekey[0];
        params.endCreateTime = params.timekey[1];
    }
    return api.post(`/api/query/dailyReport`, params, {
        loading: true,
    });
};
// 表格配置项
const columns = [
    { label: "ID", prop: "id" },
    {
        label: "日期",
        prop: "date",
        align: "left",
        search: {
            el: "date-picker",//element组件 或者使用 render自定义
            span: 1,  // grid 占位大小 
            key: "timekey", // 字段名 不填则使用 列的 prop值
            label: "日期时间", // 如果不填 者显示列名
            showLabel: true, // 是否显示Label
            props: { //组件props
                clearable: true,
                type: "datetimerange",
                valueFormat: "YYYY-MM-DD HH:mm:ss",
            },
        },
    },
    { label: "注册人数", prop: "registerNum" },
    { label: "开卡成功数", prop: "activateCard" },
    { label: "充值金额(USDT)", prop: "recharge" },
    { label: "消费金额(HKD)", prop: "consumption" },
    { label: "总余额结余(HKD)", prop: "balance" },
    { label: "总可消费余额结余(HKD)", prop: "consumptionBalance" },
    { label: "资金池金额结余(HKD)", prop: "number1" },
    { label: "未转卡金额结余(HKD)", prop: "number2" },
    { label: "今日已转入资金池总金额(HKD)", prop: "number3" },
    { label: "今日已转出资金池总金额(HKD)", prop: "number4" },
    { prop: "operation", label: "操作", align: "left", fixed: "right", width: 80 },
];


</script>
<style scoped lang='scss'></style>